summaryrefslogtreecommitdiff
path: root/src/container.h
blob: d9eeffdbb215a8e2f9cf0a7b786c978b7776b711 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef NEURAL_CONTAINER_H
#define NEURAL_CONTAINER_H

#include "neural/node.h"
#include <bu/list.h>

namespace Neural
{
	template<typename sigtype>
	class Container : public Node<sigtype>
	{
	public:
		typedef Bu::List<Neural::Node<sigtype> *> NodeList;

		Container()
		{
		}

		virtual ~Container()
		{
			for( typename NodeList::iterator i = lNodes.begin(); i; i++ )
				delete *i;
		}

		virtual void addNode( Node<sigtype> *pNode )
		{
			lNodes.append( pNode );
		}

		virtual const NodeList &getNodeList() const
		{
			return lNodes;
		}

	protected:
		virtual NodeList &getNodeList()
		{
			return lNodes;
		}

	private:
		NodeList lNodes;
	};
};

#endif